@echo off

:: Set the paths and locations
set baseDir=C:\Documents and Settings\andrew.esler\My Documents\Projects\CILADA
set ilmerge="%baseDir%\lib\ILMerge"
set testAssem="%baseDir%\CILADA.Test\TestAssemblies\CILADA.TestAssembly\bin\Release\CILADA.TestAssembly.dll"
set testAssemTwo="%baseDir%\CILADA.Test\TestAssemblies\CILADA.TestAssemblyTwo\bin\Release\CILADA.TestAssemblyTwo.dll"
set testAssemThree="%baseDir%\CILADA.Test\TestAssemblies\CILADA.TestAssemblyThree\bin\Release\CILADA.TestAssemblyThree.dll"
set ciladaEngine="%baseDir%\CILADA.Engine\bin\Release\CILADA.Engine.dll"
set ciladaCommandLine="%baseDir%\CILADA.CommandLine\bin\Release\cilada.exe" 
set mergedTestName="%baseDir%\CILADA.Test\TestAssemblies\MergedTestAssemblies"
set mergedCILADAName="%baseDir%\CILADA.Test\TestAssemblies\allcilada"
set portableCILADA="%baseDir%\CILADA.Test\TestAssemblies\portablecilada"
set log4netAssem="%baseDir%\lib\log4net.dll"
set quickGraph="%baseDir%\lib\QuickGraph.dll"
set monoCecilAssem="%baseDir%\lib\Mono.Cecil.dll"

:: remove any old version of MergedTestAssemblies
if exist %mergedTestName%.dll echo Deleting MergedTestAssemblies
if exist %mergedTestName%.dll DEL %mergedTestName%.dll
if exist %mergedTestName%.pdb DEL %mergedTestName%.pdb
:: merge the two test assemblies into one.
%ilmerge% /out:%mergedTestName%.dll %testAssem% %testAssemTwo%
if exist %mergedTestName%.dll echo Created MergedTestAssemblies.dll ...

:: remove any old version of allcilada
if exist %mergedCILADAName%.exe echo Deleting allcilada
if exist %mergedCILADAName%.exe DEL %mergedCILADAName%.exe
if exist %mergedCILADAName%.pdb DEL %mergedCILADAName%.pdb
:: Create an assembly by merging all of the CILADA projects, except CILADA.Test, CILADA.TestAssemblyFour and CILADA.TestAssemblyFive
%ilmerge% /out:%mergedCILADAName%.exe %ciladaCommandLine% %ciladaEngine% %testAssem% %testAssemTwo% %testAssemThree%
if exist %mergedCILADAName%.exe echo Created allcilada.exe ...

:: remove any old version of portablecilada
if exist %portableCILADA%.exe echo Deleting portablecilada
if exist %portableCILADA%.dll DEL %portableCILADA%.dll
if exist %portableCILADA%.pdb DEL %portableCILADA%.pdb
:: Create a cilada assembly with all its dependencies
%ilmerge% /out:%portableCILADA%.exe %ciladaCommandLine% %ciladaEngine% %log4netAssem% %monoCecilAssem% %quickGraph%
if exist %portableCILADA%.exe echo Created portablecilada.exe ...